Update to rust 2015-01-24
authorAlex Crichton <alex@alexcrichton.com>
Sun, 25 Jan 2015 06:03:42 +0000 (22:03 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Sun, 25 Jan 2015 07:48:18 +0000 (23:48 -0800)
28 files changed:
Cargo.lock
src/bin/cargo.rs
src/cargo/core/package_id.rs
src/cargo/core/shell.rs
src/cargo/core/source.rs
src/cargo/lib.rs
src/cargo/ops/cargo_package.rs
src/cargo/ops/cargo_read_manifest.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/sources/git/source.rs
src/cargo/sources/path.rs
src/cargo/sources/registry.rs
src/cargo/util/config.rs
src/cargo/util/errors.rs
src/cargo/util/profile.rs
src/rustversion.txt
src/snapshots.txt
tests/resolve.rs
tests/support/mod.rs
tests/support/registry.rs
tests/test_cargo_bench.rs
tests/test_cargo_build_auth.rs
tests/test_cargo_compile_custom_build.rs
tests/test_cargo_compile_plugins.rs
tests/test_cargo_publish.rs
tests/test_cargo_search.rs
tests/test_cargo_test.rs

index c6832f1d26cc84da448630542425e4dc2eda6803..ecf3bf05daa65b08aa61ff7c815c46f469de2f25 100644 (file)
@@ -5,20 +5,20 @@ dependencies = [
  "advapi32-sys 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "curl 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "docopt 0.6.31 (registry+https://github.com/rust-lang/crates.io-index)",
- "flate2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "flate2 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "git2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glob 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
  "log 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "registry 0.1.0",
  "rustc-serialize 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "semver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "tar 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tar 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "term 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -26,7 +26,7 @@ name = "advapi32-sys"
 version = "0.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "winapi 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -40,7 +40,7 @@ version = "0.1.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "curl-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -51,7 +51,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -66,7 +66,7 @@ dependencies = [
 
 [[package]]
 name = "flate2"
-version = "0.1.5"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "miniz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -89,20 +89,20 @@ dependencies = [
 
 [[package]]
 name = "glob"
-version = "0.1.6"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "hamcrest"
 version = "0.1.0"
-source = "git+https://github.com/carllerche/hamcrest-rust.git#445dc78024c7d912d2e52dcd3ef3dfe2c8dbab47"
+source = "git+https://github.com/carllerche/hamcrest-rust.git#69ac9ba5dc1c5bcd3219ab32d3bc5285c4e3a5c3"
 
 [[package]]
 name = "kernel32-sys"
 version = "0.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "winapi 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -117,7 +117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libssh2-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -126,7 +126,7 @@ name = "libressl-pnacl-sys"
 version = "2.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "pnacl-build-helper 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pnacl-build-helper 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -135,7 +135,7 @@ version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -170,7 +170,7 @@ dependencies = [
 
 [[package]]
 name = "openssl-sys"
-version = "0.2.16"
+version = "0.2.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -184,7 +184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "pnacl-build-helper"
-version = "1.2.0"
+version = "1.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -212,7 +212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "tar"
-version = "0.1.7"
+version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -222,7 +222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "kernel32-sys 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -253,6 +253,6 @@ dependencies = [
 
 [[package]]
 name = "winapi"
-version = "0.1.1"
+version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
index e0f9ca4eb2e334c1ddfd9cacd9409c60ab84fcce..33b5e966341564eaf397b62395a66f5f3fdbf4af 100644 (file)
@@ -202,9 +202,9 @@ fn list_commands() -> BTreeSet<String> {
             if filename.starts_with(command_prefix) &&
                     filename.ends_with(os::consts::EXE_SUFFIX) &&
                     is_executable(entry) {
-                let command = filename.slice(
-                    command_prefix.len(),
-                    filename.len() - os::consts::EXE_SUFFIX.len());
+                let command = &filename[
+                    command_prefix.len()..
+                    filename.len() - os::consts::EXE_SUFFIX.len()];
                 commands.insert(String::from_str(command));
             }
         }
index 9d999890f2252d6d70969fc6cf548581b26a02ce..d82ce75a4d3a49c2cdde382099000cf9538bbd95 100644 (file)
@@ -92,8 +92,8 @@ impl Error for PackageIdError {
 }
 
 impl fmt::Display for PackageIdError {
-    fn fmt(self, f: fmt::Formatter) {
-        match self {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
             PackageIdError::InvalidVersion(ref v) => {
                 write!(f, "invalid version: {}", *v)
             }
index 5cdf2d11710a13f462be97ea7f2fa28dc446c660..46a5f8c2d68661ceb798ef294aa26c86b960cb4c 100644 (file)
@@ -94,7 +94,7 @@ impl Shell {
         if config.tty && config.color {
             let term = TerminfoTerminal::new(out);
             term.map(|t| Shell {
-                terminal: Colored(t),
+                terminal: Colored(Box::new(t)),
                 config: config
             }).unwrap_or_else(|| {
                 Shell { terminal: NoColor(Box::new(stderr())), config: config }
index 4b5d017a2d06e7043e63bfa6002066930915e48b..b7c1c02a0edf33478c633382ac4d5a57211356f9 100644 (file)
@@ -128,7 +128,7 @@ impl SourceId {
                 SourceId::new(Kind::Registry, url)
                          .with_precise(Some("locked".to_string()))
             }
-            "path" => SourceId::for_path(&Path::new(url.slice_from(5))).unwrap(),
+            "path" => SourceId::for_path(&Path::new(&url[5..])).unwrap(),
             _ => panic!("Unsupported serialized SourceId")
         }
     }
@@ -285,7 +285,7 @@ impl fmt::Display for SourceId {
 
                 match *precise {
                     Some(ref s) => {
-                        try!(write!(f, "#{}", s.as_slice().slice_to(8)));
+                        try!(write!(f, "#{}", &s[..8]));
                     }
                     None => {}
                 }
index 7c6f6ddc57a27178a68fa7cfb164685a45360a96..e141fd20a93fe8504c1b5d6f70c75417a951c4f3 100644 (file)
@@ -107,7 +107,7 @@ pub fn process_executed<T>(result: CliResult<Option<T>>, shell: &mut MultiShell)
     match result {
         Err(e) => handle_error(e, shell),
         Ok(Some(encodable)) => {
-            let encoded = json::encode(&encodable);
+            let encoded = json::encode(&encodable).unwrap();
             println!("{}", encoded);
         }
         _ => {}
@@ -134,16 +134,10 @@ pub fn shell(verbose: bool) -> MultiShell {
 // `output` print variant error strings to either stderr or stdout.
 // For fatal errors, print to stderr;
 // and for others, e.g. docopt version info, print to stdout.
-fn output(caption: Option<&str>, detail: Option<String>,
-          shell: &mut MultiShell, fatal: bool) {
+fn output(err: String, shell: &mut MultiShell, fatal: bool) {
     let std_shell = if fatal {shell.err()} else {shell.out()};
-    if let Some(caption) = caption {
-        let color = if fatal {RED} else {BLACK};
-        let _ = std_shell.say(caption, color);
-    }
-    if let Some(detail) = detail {
-        let _ = std_shell.say(detail, BLACK); // always black
-    }
+    let color = if fatal {RED} else {BLACK};
+    let _ = std_shell.say(err, color);
 }
 
 pub fn handle_error(err: CliError, shell: &mut MultiShell) {
@@ -153,17 +147,13 @@ pub fn handle_error(err: CliError, shell: &mut MultiShell) {
     let fatal = exit_code != 0; // exit_code == 0 is non-fatal error
 
 
-    let desc = error.description();
-    let hide_desc = unknown && !shell.get_verbose();
-    if hide_desc {
-        output(Some("An unknown error occurred"), None, shell, fatal);
-    } else if desc.len() > 0 {
-        output(Some(desc), None, shell, fatal);
+    let hide = unknown && !shell.get_verbose();
+    if hide {
+        let _ = shell.err().say("An unknown error occurred", RED);
+    } else {
+        output(error.to_string(), shell, fatal);
     }
-    if shell.get_verbose() {
-        output(None, error.detail(), shell, fatal);
-    }
-    if !handle_cause(&*error, shell) || (hide_desc && !desc.is_empty()) {
+    if !handle_cause(&*error, shell) || hide {
         let _ = shell.err().say("\nTo learn more, run the command again \
                                  with --verbose.".to_string(), BLACK);
     }
@@ -180,23 +170,18 @@ fn handle_cause(mut cargo_err: &CargoError, shell: &mut MultiShell) -> bool {
             None => { err = cargo_err.cause(); break }
         };
         if !verbose && !cargo_err.is_human() { return false }
-        print(cargo_err.description(), cargo_err.detail(), shell);
+        print(cargo_err.to_string(), shell);
     }
     loop {
         let cause = match err { Some(err) => err, None => return true };
         if !verbose { return false }
-        print(cause.description(), cause.detail(), shell);
+        print(cause.to_string(), shell);
         err = cause.cause();
     }
 
-    fn print(desc: &str, detail: Option<String>, shell: &mut MultiShell) {
+    fn print(error: String, shell: &mut MultiShell) {
         let _ = shell.err().say("\nCaused by:", BLACK);
-        let _ = shell.err().say(format!("  {}", desc), BLACK);
-        if shell.get_verbose() {
-            if let Some(detail) = detail {
-                let _ = shell.err().say(detail, BLACK);
-            }
-        }
+        let _ = shell.err().say(format!("  {}", error), BLACK);
     }
 }
 
index e158ccd31256cc8531819a71abf13068942dc0e9..d7ed2bcd18d010b5f453a5e111cd92baa493773e 100644 (file)
@@ -87,7 +87,7 @@ fn check_metadata(pkg: &Package, config: &Config) -> CargoResult<()> {
     lacking!(description, license || license_file, documentation || homepage || repository);
 
     if !missing.is_empty() {
-        let mut things = missing.slice_to(missing.len() - 1).connect(", ");
+        let mut things = missing[..missing.len() - 1].connect(", ");
         // things will be empty if and only if length == 1 (i.e. the only case to have no `or`).
         if !things.is_empty() {
             things.push_str(" or ");
index 3dc1aba68968beb32ab049719278a6132d5668a3..9c6b50b0dd05a5d107edf3d1c6bca5807c31db84 100644 (file)
@@ -13,8 +13,8 @@ pub fn read_manifest(contents: &[u8], layout: Layout, source_id: &SourceId,
                      -> CargoResult<(Manifest, Vec<Path>)> {
     let root = layout.root.clone();
     util::toml::to_manifest(contents, source_id, layout, config).chain_error(|| {
-        human(format!("failed to parse manifest at `{:?}`",
-                      root.join("Cargo.toml")))
+        human(format!("failed to parse manifest at `{}`",
+                      root.join("Cargo.toml").display()))
     })
 }
 
index 7f765a354d4a3c7634ca64d4d2a0c834634183b7..95752de97aa2dd6eda02c2d1d32115d312a963b1 100644 (file)
@@ -241,7 +241,7 @@ fn calculate_target_fresh(dep_info: &Path) -> CargoResult<bool> {
         internal(format!("dep-info not in an understood format: {}",
                          dep_info.display()))
     }));
-    let deps = line.slice_from(pos + 2);
+    let deps = &line[pos + 2..];
 
     let mut deps = deps.split(' ').map(|s| s.trim()).filter(|s| !s.is_empty());
     loop {
index 2b9724847c5ad03da57a2c6acd8c8676da205008..20e72393a96ae29a81fe43d42f1c2880319d5e58 100644 (file)
@@ -67,7 +67,7 @@ pub fn rustc_old_version() -> CargoResult<(String, String)> {
     let triple = {
         let triple = output.as_slice().lines().filter(|l| {
             l.starts_with("host: ")
-        }).map(|l| l.slice_from(6)).next();
+        }).map(|l| &l[6..]).next();
         let triple = try!(triple.chain_error(|| {
             internal("rustc -v didn't have a line for `host:`")
         }));
@@ -86,7 +86,7 @@ pub fn rustc_new_version() -> CargoResult<(String, String)> {
     let triple = {
         let triple = output.as_slice().lines().filter(|l| {
             l.starts_with("host: ")
-        }).map(|l| l.slice_from(6)).next();
+        }).map(|l| &l[6..]).next();
         let triple = try!(triple.chain_error(|| {
             internal("rustc -v didn't have a line for `host:`")
         }));
index 54c0064c498e4d0eef37be5075556dd364a8ec35..405590dea8347c48d845838a6c6b05b93aa213ae 100644 (file)
@@ -134,7 +134,7 @@ pub fn canonicalize_url(url: &Url) -> Url {
             if needs_chopping {
                 let last = rel.path.pop().unwrap();
                 let last = last.as_slice();
-                rel.path.push(last.slice_to(last.len() - 4).to_string())
+                rel.path.push(last[..last.len() - 4].to_string())
             }
         }
         _ => {}
index b27b31c3cd1b2ad7ea28c443ab9b693016eca08f..3fc6990f27ecebd7f7c6f4df1dbc09b5f0de04ee 100644 (file)
@@ -74,12 +74,15 @@ impl<'a, 'b> PathSource<'a, 'b> {
     pub fn list_files(&self, pkg: &Package) -> CargoResult<Vec<Path>> {
         let root = pkg.get_manifest_path().dir_path();
 
-        let exclude = pkg.get_manifest().get_exclude().iter().map(|p| {
-            Pattern::new(p.as_slice())
-        }).collect::<Vec<Pattern>>();
-        let include = pkg.get_manifest().get_include().iter().map(|p| {
-            Pattern::new(p.as_slice())
-        }).collect::<Vec<Pattern>>();
+        let parse = |&: p: &String| {
+            Pattern::new(p.as_slice()).map_err(|e| {
+                human(format!("could not parse pattern `{}`: {}", p, e))
+            })
+        };
+        let exclude = try!(pkg.get_manifest().get_exclude().iter()
+                              .map(|p| parse(p)).collect::<Result<Vec<_>, _>>());
+        let include = try!(pkg.get_manifest().get_include().iter()
+                              .map(|p| parse(p)).collect::<Result<Vec<_>, _>>());
 
         let mut filter = |&mut: p: &Path| {
             let relative_path = p.path_relative_from(&root).unwrap();
index 6f0542f9426e12b67a58f5206c83cc36e0863eae..d3e311cf135e270d9b628652113ec08104ae1fcd 100644 (file)
@@ -367,9 +367,9 @@ impl<'a, 'b> RegistrySource<'a, 'b> {
         let path = match fs_name.len() {
             1 => path.join("1").join(fs_name),
             2 => path.join("2").join(fs_name),
-            3 => path.join("3").join(fs_name.slice_to(1)).join(fs_name),
-            _ => path.join(fs_name.slice(0, 2))
-                     .join(fs_name.slice(2, 4))
+            3 => path.join("3").join(&fs_name[..1]).join(fs_name),
+            _ => path.join(&fs_name[0..2])
+                     .join(&fs_name[2..4])
                      .join(fs_name),
         };
         let summaries = match File::open(&path) {
index f7c64d982e837832dc6ead3e49fb1b1abaab2249..40cca91539ad030c549cab62e13ab738a44b5c06 100644 (file)
@@ -114,10 +114,11 @@ impl<'a> Config<'a> {
                 CV::Boolean(_, ref path) => {
                     let idx = key.split('.').take(i)
                                  .fold(0, |n, s| n + s.len()) + i - 1;
-                    let key_so_far = key.slice_to(idx);
+                    let key_so_far = &key[..idx];
                     return Err(human(format!("expected table for configuration \
-                                              key `{}`, but found {} in {:?}",
-                                             key_so_far, val.desc(), path)));
+                                              key `{}`, but found {} in {}",
+                                             key_so_far, val.desc(),
+                                             path.display())));
                 }
             }
         }
@@ -163,13 +164,13 @@ impl<'a> Config<'a> {
             let contents = try!(file.read_to_string());
             let table = try!(cargo_toml::parse(contents.as_slice(),
                                                &path).chain_error(|| {
-                human(format!("could not parse TOML configuration in `{:?}`",
-                              path))
+                human(format!("could not parse TOML configuration in `{}`",
+                              path.display()))
             }));
             let toml = toml::Value::Table(table);
             let value = try!(CV::from_toml(&path, toml).chain_error(|| {
-                human(format!("failed to load TOML configuration from `{:?}`",
-                              path))
+                human(format!("failed to load TOML configuration from `{}`",
+                              path.display()))
             }));
             try!(cfg.merge(value));
             Ok(())
@@ -202,16 +203,19 @@ pub enum ConfigValue {
 impl fmt::Debug for ConfigValue {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
-            CV::Integer(i, ref path) => write!(f, "{} (from {:?})", i, path),
-            CV::Boolean(b, ref path) => write!(f, "{} (from {:?})", b, path),
-            CV::String(ref s, ref path) => write!(f, "{} (from {:?})", s, path),
+            CV::Integer(i, ref path) => write!(f, "{} (from {})", i,
+                                               path.display()),
+            CV::Boolean(b, ref path) => write!(f, "{} (from {})", b,
+                                               path.display()),
+            CV::String(ref s, ref path) => write!(f, "{} (from {})", s,
+                                                  path.display()),
             CV::List(ref list, ref path) => {
                 try!(write!(f, "["));
                 for (i, &(ref s, ref path)) in list.iter().enumerate() {
                     if i > 0 { try!(write!(f, ", ")); }
                     try!(write!(f, "{} (from {})", s, path.display()));
                 }
-                write!(f, "] (from {:?})", path)
+                write!(f, "] (from {})", path.display())
             }
             CV::Table(ref table, _) => write!(f, "{:?}", table),
         }
@@ -357,8 +361,9 @@ impl ConfigValue {
     }
 
     fn expected<T>(&self, wanted: &str) -> CargoResult<T> {
-        Err(internal(format!("expected a {}, but found a {} in {:?}",
-                             wanted, self.desc(), self.definition_path())))
+        Err(internal(format!("expected a {}, but found a {} in {}",
+                             wanted, self.desc(),
+                             self.definition_path().display())))
     }
 
     fn into_toml(self) -> toml::Value {
index 32f65372ad187325e013f872f1546462f139c29a..c738ed70f930a36dc56fd34ecf4f1d26fcb95625 100644 (file)
@@ -17,17 +17,11 @@ pub type CargoResult<T> = Result<T, Box<CargoError>>;
 // =============================================================================
 // CargoError trait
 
-pub trait CargoError: Error {
+pub trait CargoError: Error + Send {
     fn is_human(&self) -> bool { false }
     fn cargo_cause(&self) -> Option<&CargoError>{ None }
 }
 
-impl fmt::Display for Box<CargoError> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{}", self.description()));
-        Ok(())
-    }
-}
 impl fmt::Debug for Box<CargoError> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Display::fmt(self, f)
@@ -91,8 +85,8 @@ impl<E: Error> Error for ChainedError<E> {
 }
 
 impl<E: fmt::Display> fmt::Display for ChainedError<E> {
-    fn fmt(&self, f: fmt::Formatter) {
-        fmt::Display::fmt(self.error, f)
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.error, f)
     }
 }
 
@@ -135,13 +129,17 @@ impl fmt::Debug for ProcessError {
 struct ConcreteCargoError {
     description: String,
     detail: Option<String>,
-    cause: Option<Box<Error>>,
+    cause: Option<Box<Error+Send>>,
     is_human: bool,
 }
 
 impl fmt::Display for ConcreteCargoError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", self.description)
+        try!(write!(f, "{}", self.description));
+        if let Some(ref s) = self.detail {
+            try!(write!(f, " ({})", s));
+        }
+        Ok(())
     }
 }
 impl fmt::Debug for ConcreteCargoError {
@@ -153,7 +151,9 @@ impl fmt::Debug for ConcreteCargoError {
 impl Error for ConcreteCargoError {
     fn description(&self) -> &str { self.description.as_slice() }
     fn cause(&self) -> Option<&Error> {
-        self.cause.as_ref().map(|c| &**c)
+        self.cause.as_ref().map(|c| {
+            let e: &Error = &**c; e
+        })
     }
 }
 
@@ -174,8 +174,8 @@ impl<E: Error> Error for Human<E> {
 }
 
 impl<E: fmt::Display> fmt::Display for Human<E> {
-    fn fmt(self, f: fmt::Formatter) {
-        fmt::Display::fmt(self.0, f)
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.0, f)
     }
 }
 
@@ -202,8 +202,8 @@ impl Error for CliError {
 }
 
 impl fmt::Display for CliError {
-    fn fmt(self, f: fmt::Formatter) {
-        fmt::Display::fmt(self.error, f)
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.error, f)
     }
 }
 
@@ -330,11 +330,11 @@ pub fn human<S: fmt::Display>(error: S) -> Box<CargoError> {
     })
 }
 
-pub fn caused_human<S: fmt::Display, E: Error>(error: S, cause: E) -> Box<CargoError> {
+pub fn caused_human<S: fmt::Display, E: Error + Send>(error: S, cause: E) -> Box<CargoError> {
     Box::new(ConcreteCargoError {
         description: error.to_string(),
         detail: None,
-        cause: Some(Box::new(cause) as Box<Error>),
+        cause: Some(Box::new(cause) as Box<Error + Send>),
         is_human: true
     })
 }
index c2a932b71e60c9cf674cdddd68bfa936c6799da3..c5aa87ed4e437c10ea8df6fd612eeed272f9bb1d 100644 (file)
@@ -42,7 +42,7 @@ impl Drop for Profiler {
                     println!("{} {:6}ms - {}", repeat("    ").take(lvl + 1).collect::<String>(),
                         time / 1000000, msg);
 
-                    print(lvl + 1, msgs.slice(last, i));
+                    print(lvl + 1, &msgs[last..i]);
                     last = i;
                 }
 
index 428e67a0a730f292014d8664cafa77eac6b37f10..05c8f09f671af4975a2b5af5767980f9862e650b 100644 (file)
@@ -1 +1 @@
-2015-01-18
+2015-01-24
index 29ab022530d184f32737c99557cdd8c7778b8ae0..b95d4da6dec80e287d1dfdd61ac4b5676a5f8c4c 100644 (file)
@@ -1,3 +1,11 @@
+2015-01-24
+  linux-i386 96213038f850569f1c4fa6a0d146c6155c0d566b
+  linux-x86_64 4d87486493c2881edced7b1d2f8beaac32aaa5b5
+  macos-i386 17b9fc782e86bffe170abb83a01e0cb7c90a0daa
+  macos-x86_64 18887bdbd3e6d2a127aa34216fa06e9877b0fbc6
+  winnt-i386 10b9b5fa3e9241ef0b6c3b77b0c072a45b585905
+  winnt-x86_64 ba71627e46964535b64da56bd0679e5f86fae957
+
 2014-12-30
   linux-i386 ab8bba0918d3d2ddbd7fd21f147e223dbf04cece
   linux-x86_64 0efe0f7bcbcbeb5494affcc8a2207db448a08c45
index 9dcd97219acb17875f466e10a9606586665843d2..3198adcecab645f8091a040f13ef58b4569f2f28 100644 (file)
@@ -334,7 +334,7 @@ fn resolving_but_no_exists() {
     ], &mut reg);
     assert!(res.is_err());
 
-    assert_eq!(res.unwrap_err().to_string(), "\
+    assert_eq!(res.err().unwrap().to_string(), "\
 no matching package named `foo` found (required by `root`)
 location searched: registry http://example.com/
 version required: ^1\
index 052dcedef965811a3a3b5e81a4afeb1d0d6dcded..4a814821e3bb5b69f858c25658957c607a7aaf0f 100644 (file)
@@ -349,7 +349,7 @@ impl Execs {
 fn lines_match(expected: &str, mut actual: &str) -> bool {
     for part in expected.split_str("[..]") {
         match actual.find_str(part) {
-            Some(i) => actual = actual.slice_from(i + part.len()),
+            Some(i) => actual = &actual[i + part.len()..],
             None => {
                 return false
             }
@@ -485,7 +485,7 @@ pub fn basic_lib_manifest(name: &str) -> String {
 }
 
 pub fn path2url(p: Path) -> Url {
-    Url::from_file_path(&p).unwrap()
+    Url::from_file_path(&p).ok().unwrap()
 }
 
 pub static RUNNING:     &'static str = "     Running";
index dbd8164c73180c4ab433af16eebcdb1dfb173eeb..4c3a2be18e0f9d9a7bc819f42b5da6d152358031 100644 (file)
@@ -13,9 +13,9 @@ use support::git::repo;
 use cargo::util::Sha256;
 
 pub fn registry_path() -> Path { paths::root().join("registry") }
-pub fn registry() -> Url { Url::from_file_path(&registry_path()).unwrap() }
+pub fn registry() -> Url { Url::from_file_path(&registry_path()).ok().unwrap() }
 pub fn dl_path() -> Path { paths::root().join("dl") }
-pub fn dl_url() -> Url { Url::from_file_path(&dl_path()).unwrap() }
+pub fn dl_url() -> Url { Url::from_file_path(&dl_path()).ok().unwrap() }
 
 pub fn init() {
     let config = paths::home().join(".cargo/config");
index 3108b0bc22cb628999ccba39bb23ba025b614d74..bad1e62e528c4aa07046128a6f68a5788fd0e36d 100644 (file)
@@ -185,6 +185,7 @@ test bench_hello ... ",
 thread '<main>' panicked at 'assertion failed: \
     `(left == right) && (right == left)` (left: \
     `\"hello\"`, right: `\"nope\"`)', src{sep}foo.rs:14
+
 ", sep = path::SEP))
               .with_status(101));
 });
index 048ad3d3d20b0be221cc4990e07ccf2993312552..ff6bdf6994f7e0fad6a5f5bd2ea36138b9839748 100644 (file)
@@ -164,10 +164,10 @@ Caused by:
 ",
         addr = addr,
         errmsg = if cfg!(windows) {
-            "failed to send request: The connection with the server \
+            "[[..]] failed to send request: The connection with the server \
              was terminated abnormally\n"
         } else {
-            "SSL error: [..]"
+            "[[..]] SSL error: [..]"
         })));
 
     t.join().ok().unwrap();
@@ -210,7 +210,7 @@ Caused by:
   failed to clone into: [..]
 
 Caused by:
-  Failed to start SSH session: Failed getting banner
+  [[..]] Failed to start SSH session: Failed getting banner
 ",
         addr = addr)));
     t.join().ok().unwrap();
index 361f41171a8029cb16b7b50ada3b05b38dfb356b..b339a12620b254d0fc2505742c916449d939ea8a 100644 (file)
@@ -1031,8 +1031,8 @@ test!(build_script_with_dynamic_native_dependency {
             lib.ends_with(os::consts::DLL_SUFFIX)
     }).unwrap();
     let libname = lib.filename_str().unwrap();
-    let libname = libname.slice(os::consts::DLL_PREFIX.len(),
-                                libname.len() - os::consts::DLL_SUFFIX.len());
+    let libname = &libname[os::consts::DLL_PREFIX.len()..
+                           libname.len() - os::consts::DLL_SUFFIX.len()];
 
     let foo = project("foo")
         .file("Cargo.toml", r#"
index c246e854ff54049acc80a613b20d73f8f69b70ad..d20714cb725bbdec47ef6448af8c88d0ef8cf540 100644 (file)
@@ -107,8 +107,8 @@ test!(plugin_with_dynamic_native_dependency {
             lib.ends_with(os::consts::DLL_SUFFIX)
     }).unwrap();
     let libname = lib.filename_str().unwrap();
-    let libname = libname.slice(os::consts::DLL_PREFIX.len(),
-                                libname.len() - os::consts::DLL_SUFFIX.len());
+    let libname = &libname[os::consts::DLL_PREFIX.len()..
+                           libname.len() - os::consts::DLL_SUFFIX.len()];
 
     let foo = project("foo")
         .file("Cargo.toml", r#"
index ab35614b68d486361870d1b852a3f58650d063b6..62b5f129e0bbf336b9d05c596922821752851d31 100644 (file)
@@ -12,9 +12,9 @@ use support::git::repo;
 use hamcrest::assert_that;
 
 fn registry_path() -> Path { paths::root().join("registry") }
-fn registry() -> Url { Url::from_file_path(&registry_path()).unwrap() }
+fn registry() -> Url { Url::from_file_path(&registry_path()).ok().unwrap() }
 fn upload_path() -> Path { paths::root().join("upload") }
-fn upload() -> Url { Url::from_file_path(&upload_path()).unwrap() }
+fn upload() -> Url { Url::from_file_path(&upload_path()).ok().unwrap() }
 
 fn setup() {
     let config = paths::root().join(".cargo/config");
index 6a9462eaec5954a375b64a97a6af7b576a47e894..e265bbbb4b7c496c1f9769d316d0ef5d202ea03f 100644 (file)
@@ -11,9 +11,9 @@ use support::git::repo;
 use hamcrest::assert_that;
 
 fn registry_path() -> Path { paths::root().join("registry") }
-fn registry() -> Url { Url::from_file_path(&registry_path()).unwrap() }
+fn registry() -> Url { Url::from_file_path(&registry_path()).ok().unwrap() }
 fn api_path() -> Path { paths::root().join("api") }
-fn api() -> Url { Url::from_file_path(&api_path()).unwrap() }
+fn api() -> Url { Url::from_file_path(&api_path()).ok().unwrap() }
 
 fn setup() {
     let config = paths::root().join(".cargo/config");
index f9478626f9e73c954dfd962ab3c72f6dd60594fc..e9e833a22eb5fc687941e8de11bfb9e34adabacc 100644 (file)
@@ -151,6 +151,7 @@ test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
         sep = path::SEP))
               .with_stderr(format!("\
 thread '<main>' panicked at 'Some tests failed', [..]
+
 "))
               .with_status(101));
 });